/**
 * @Package: 	com.group.pojo 
 * @author: 	Liu  
 * @date: 		Dec 27, 2018 8:20:54 AM 
 */
package com.group.pojo;

import java.util.List;

import com.group.DAO.GWorkDAO;

/**
 * @ClassName:	 GWork.java
 * @Description: 该类的功能描述
 * @author:		 Liu
 * @date: 		 Dec 27, 2018 8:20:54 AM 
 */
public class GWork {
	// @Fields workID : 任务ID
	int workID;
	// @Fields workTitle : 任务标题
	String workTitle;
	// @Fields workContent : 任务内容
	String workContent;
	// @Fields workBegin : 开始时间
	String workBegin;
	// @Fields workEnd : 结束时间
	String workEnd;
	// @Fields groupList : 分配的小组
	List<String> groupList;
	// @Fields openEva : 开启评价(任务过期)
	boolean openEva;
	
	public GWork() {}
	public GWork(String workTitle, String workContent, String workEnd) {
		this.workTitle = workTitle;
		this.workContent = workContent;
		this.workEnd = workEnd;
	}
	
	public List<GWork> getGWorkList(){
		GWorkDAO dao = new GWorkDAO();
		return dao.getGWorkList();
	}
	
	/**
	 * @Function: 	 GWork.java
	 * @Description: 发布任务                             
	 * @param:		   任务类                            
	 * @return:		                                  
	 * @author: 	 Liu
	 * @date:		 Dec 30, 2018 10:00:24 PM 
	 */
	public void addWork(GWork w, String[] groupID) {
		GWorkDAO dao = new GWorkDAO();
		dao.addWork(w, groupID);
	}
	
	/**
	 * @Function: 	 GWork.java
	 * @Description: 获取最新发布任务的ID(暂时不用)             
	 * @param:		   参数                      
	 * @return:		   任务ID                    
	 * @author: 	 Liu
	 * @date:		 Dec 31, 2018 7:20:55 PM 
	 */
	public int getTheLastestWorkID() {
		GWorkDAO dao  = new GWorkDAO();
		return dao.getTheLastestWorkID();
	}
	
	
	
	/**
	 * @Function: 	 GWork.java
	 * @Description: 获取任务信息                                 
	 * @param:		   任务ID                                 
	 * @return:		   任务类                                  
	 * @author: 	 Liu
	 * @date:		 Dec 31, 2018 3:57:35 PM 
	 */
	public GWork getGWorkInfoByID(int workID) {
		GWorkDAO dao = new GWorkDAO();
		return dao.getGWorkInfoByID(workID);
	}
	
	/**
	 * @Function: 	 GWork.java
	 * @Description: 编辑任务信息                               
	 * @param:		   任务，小组ID列表                           
	 * @return:		                                       
	 * @author: 	 Liu
	 * @date:		 Dec 31, 2018 7:22:06 PM 
	 */
	public void updateWorkInfo(GWork w, String[] groupID) {
		GWorkDAO dao = new GWorkDAO();
		dao.updateWorkInfo(w, groupID);
	}
	
	/**
	 * @Function: 	 GWork.java
	 * @Description: 删除任务                             
	 * @param:		   任务ID                           
	 * @return:		                                  
	 * @author: 	 Liu
	 * @date:		 Dec 31, 2018 8:36:29 PM 
	 */
	public void deleteWorkByID(int workID) {
		GWorkDAO dao = new GWorkDAO();
		dao.deleteWorkByID(workID);
	}
	
	/**
	 * @Function: 	 GWork.java
	 * @Description: 判断任务是否过期                              
	 * @param:		   任务结束时间                              
	 * @return:		   过期(true)/未过期(false)                 
	 * @author: 	 Liu
	 * @date:		 Jan 2, 2019 8:09:49 AM 
	 */
	public boolean isPassed(String workEnd) {
		GWorkDAO dao = new GWorkDAO();
		return dao.isPassed(workEnd);
	}
	
	public int getWorkID() {
		return workID;
	}
	public void setWorkID(int workID) {
		this.workID = workID;
	}
	public String getWorkTitle() {
		return workTitle;
	}
	public void setWorkTitle(String workTitle) {
		this.workTitle = workTitle;
	}
	public String getWorkContent() {
		return workContent;
	}
	public void setWorkContent(String workContent) {
		this.workContent = workContent;
	}
	public String getWorkBegin() {
		return workBegin;
	}
	public void setWorkBegin(String workBegin) {
		this.workBegin = workBegin;
	}
	public String getWorkEnd() {
		return workEnd;
	}
	public void setWorkEnd(String workEnd) {
		this.workEnd = workEnd;
	}
	public List<String> getGroupList() {
		return groupList;
	}
	public void setGroupList(List<String> groupList) {
		this.groupList = groupList;
	}
	public boolean isOpenEva() {
		return openEva;
	}
	public void setOpenEva(boolean openEva) {
		this.openEva = openEva;
	}
}
